package com.outsource.framework.util.unicom.news.sso.httpclient;

import java.io.IOException;
import java.util.Locale;

import org.apache.http.Header;
import org.apache.http.HeaderIterator;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
import org.apache.http.ProtocolVersion;
import org.apache.http.StatusLine;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;

public class HttpResponseWrapper
{
	private HttpResponse response;
	private String body;

	public HttpResponseWrapper(HttpResponse response)
	{
		super();
		this.response = response;
		// body
		HttpEntity entity = response.getEntity();
		try
		{
			this.body = entity == null ? null : EntityUtils.toString(entity);
		} catch (ParseException e)
		{
			e.printStackTrace();
		} catch (IOException e)
		{
			e.printStackTrace();
		}
	}

	public ProtocolVersion getProtocolVersion()
	{
		return response.getProtocolVersion();
	}

	public Header[] getHeaders(String name)
	{
		return response.getHeaders(name);
	}

	public Header[] getAllHeaders()
	{
		return response.getAllHeaders();
	}

	public Locale getLocale()
	{
		return response.getLocale();
	}

	public HeaderIterator headerIterator()
	{
		return response.headerIterator();
	}

	public HttpParams getParams()
	{
		return response.getParams();
	}

	public String getBody()
	{
		return this.body;
	}

	public StatusLine getStatusLine()
	{
		return response.getStatusLine();
	}
}
